<!DOCTYPE html>
<html>
<head>
	<title></title>
	<style>
		
	</style>
</head>
<body>
	<h1>JS 对象</h1>
    <h1>JS 对象</h1>
    <h1>JS 对象</h1>
    <h1>JS 对象</h1>
    <hr>

</body>
	<script>
		//Object 构造函数
		var obj1 = new Object();
		obj1.name = '静静';
		obj1.age = 19;
		obj1.getInfo = function(){
			document.write('OBJ1<br>');
		}
		console.log(obj1);
		obj1.getInfo();
		console.log(obj1.name);



		//JSON方式 (推荐)
		var obj2 = {
			age : 18,
			sex : '男',
			getInfo : function(){
				document.write("OBJ2<br>");
			}
		};
		obj2.name = '洋洋';
		console.log(obj2);
		obj2.getInfo();

		//自定义函数结构方式
		function User(){
			this.name = '艳艳';
			this.age=28;
			this.getInfo = function(){
				document.write("OBJ3<br>");
			}
		}
		var obj3 = new User();
		console.log(obj3);
		console.log(obj3.name);
		obj3.getInfo();

		//匿名构造函数方式
		//自定义构造函数+表达式方式
		var  obj4 = new function(){
			this.name = '舒舒';
			this.age =38;
			this.getInfo = function(){
				document.write("OBJ4<br>");
			}
		}
		console.log(obj4);
		console.log(obj4.name);
		obj4.getInfo();

		console.log('obj1:'+obj1.constructor);
		console.log('obj2:'+obj2.constructor);
		console.log('obj3:'+obj3.constructor);
		console.log('obj4:'+obj4.constructor);
		console.log('一句话'.constructor);

		//var hh = document.getElementById('') //NO
		var hh = document.getElementsByTagName("h1");
		console.log(hh);
		console.log(hh.constructor);
		console.log(hh[0].constructor);

	</script>
</html>